<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
  <title>new (MywikiController)</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
</head>
<body class="standalone-code">
  <pre><span class="ruby-comment cmt"># File app/controllers/mywiki_controller.rb, line 62</span>
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">new</span>
        <span class="ruby-ivar">@page</span> = <span class="ruby-value str">&quot;new&quot;</span>; <span class="ruby-identifier">p</span> <span class="ruby-value str">'Page: '</span><span class="ruby-operator">+</span><span class="ruby-ivar">@page</span>
        <span class="ruby-identifier">get_user</span>
        <span class="ruby-ivar">@priv</span> = <span class="ruby-ivar">@user</span>[<span class="ruby-value str">'c_priv'</span>]
        <span class="ruby-identifier">p</span> <span class="ruby-ivar">@user</span>
        <span class="ruby-identifier">p</span> <span class="ruby-ivar">@priv</span>
        <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@priv</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">false</span> 
          <span class="ruby-identifier">flash</span>[<span class="ruby-identifier">:error</span>] = <span class="ruby-value str">'You do not have permission to create pages'</span>          
          <span class="ruby-identifier">redirect_to</span> <span class="ruby-identifier">:action</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:index</span>                
        <span class="ruby-keyword kw">else</span> 
                <span class="ruby-comment cmt"># do not show search form with create new page form</span>
                <span class="ruby-ivar">@search</span> = <span class="ruby-keyword kw">false</span>
                <span class="ruby-identifier">gen_content</span>
                
            <span class="ruby-ivar">@mywiki</span> = <span class="ruby-constant">Mywiki</span>.<span class="ruby-identifier">new</span>
                <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:f</span>].<span class="ruby-identifier">nil?</span>
                        <span class="ruby-comment cmt">#noop</span>
                <span class="ruby-keyword kw">else</span>
                        <span class="ruby-ivar">@mywiki</span>.<span class="ruby-identifier">title</span> = <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:f</span>]
                <span class="ruby-keyword kw">end</span>
                <span class="ruby-ivar">@mywiki</span>.<span class="ruby-identifier">userid</span> = <span class="ruby-ivar">@id</span>          
        <span class="ruby-keyword kw">end</span>    
  <span class="ruby-keyword kw">end</span></pre>
</body>
</html>